$(function() {
	$("#txt_login_username").val("");
	$("#txt_login_password").val("");
	$("#txt_login_username").removeClass("error");
	$("#txt_login_password").removeClass("error");
	$("#txt_login_username").focus();
	$(".tip").tooltip({
		placement : "right"
	});

	// LOGIN DE USUARIOS
	$("#frm_login").validate({
		rules : {
			txt_login_username : {
				required : true
			},
			txt_login_password : {
				required : true,
				minlength : 6
			}
		},
		messages : {
			txt_login_username : {
				required : " *requerido"
			},
			txt_login_password : {
				required : " *requerido",
				minlength : " *minimo 6 caracteres"
			}
		},
		errorPlacement : function(error, element) {
			if (element.attr("name") == "txt_login_username") {
				$("#msg_txt_login_username").html(error);
			} else if (element.attr("name") == "txt_login_password") {
				$("#msg_txt_login_password").html(error);
			}
		}
	});
});

// CAMBIAR PASSWORD
$(function() {
	$("#frm_cambiarPassword").validate({
		submitHandler : function() {
			alert("paso validacion!");
		},
		rules : {
			txt_CP_userid : {
				required : true
			},
			txt_CP_oldpassword : {
				required : true
			},
			txt_CP_newpassword : {
				required : true
			},
			txt_CP_confpassword : {
				required : true,
				equalTo : "#txt_CP_newpassword"
			}
		},
		messages : {
			txt_CP_userid : {
				required : " *requerido"
			},
			txt_CP_oldpassword : {
				required : " *requerido"
			},
			txt_CP_newpassword : {
				required : " *requerido"
			},
			txt_CP_confpassword : {
				required : " *requerido",
				equalTo : " *passwords no coinciden"
			}
		},
		errorPlacement : function(error, element) {
			if (element.attr("name") == "txt_CP_userid") {
				$("#msg_txt_CP_userid").html(error);
			} else if (element.attr("name") == "txt_CP_oldpassword") {
				$("#msg_txt_CP_oldpassword").html(error);
			} else if (element.attr("name") == "txt_CP_newpassword") {
				$("#msg_txt_CP_newpassword").html(error);
			} else if (element.attr("name") == "txt_CP_confpassword") {
				$("#msg_txt_CP_confpassword").html(error);
			}

		}
	});
});

// OLVIDE PASSWORD
$(function() {
	$("#frm_olvidePassword").validate({
		submitHandler : function() {
			alert("paso validacion!");
		},
		rules : {
			txt_OP_user : {
				required : true
			}
		},
		messages : {
			txt_OP_user : {
				required : " *requerido"
			}
		},
		errorPlacement : function(error, element) {
			if (element.attr("name") == "txt_OP_user") {
				$("#msg_txt_OP_user").html(error);
			}
		}
	});
});